package com.yunmaozj.tools.lock.annotations;

import org.springframework.context.annotation.AdviceMode;
import org.springframework.context.annotation.AdviceModeImportSelector;
import org.springframework.context.annotation.AutoProxyRegistrar;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration;
import org.springframework.transaction.config.TransactionManagementConfigUtils;
import org.springframework.util.ClassUtils;

/**
 * @author 钟明宏
 * @version V1.0
 * @date 2021-08-30 16:59
 **/
public class DistributedLockConfigurationSelector extends AdviceModeImportSelector<EnableDistributedLock> {

    @Override
    protected String[] selectImports(AdviceMode adviceMode) {
        switch (adviceMode) {
            case PROXY:
                return new String[]{AutoProxyRegistrar.class.getName(),
                        DistributedLockConfiguration.class.getName()};
            case ASPECTJ:
                return new String[]{AutoProxyRegistrar.class.getName(),
                        DistributedLockConfiguration.class.getName()};
            default:
                return null;
        }
    }


}
